/*
 * @Company: TWL
 * @Author: xue jian
 * @Email: xuejian@kanzhun.com
 * @Date: 2019-11-08 10:36:40
 */
#include "rocksdb/db.h"
#include <iostream>

int main(int argc, char** argv) {
    rocksdb::DB* db;
    std::cout<<"begin"<<std::endl;
    rocksdb::Options options;
    options.create_if_missing = true;
    rocksdb::Status status = rocksdb::DB::Open(options, "rocks_test", &db);
    if (status.ok()) {
        std::cout<<"open the db success"<<std::endl;
    }
    std::cout<<"open db"<<std::endl;
    std::vector<rocksdb::ColumnFamilyHandle*> tmp_handle;

    std::vector<rocksdb::ColumnFamilyDescriptor> column_families;
    column_families.emplace_back("haha", rocksdb::ColumnFamilyOptions());
    status = db->CreateColumnFamilies(column_families, &tmp_handle);
    std::cout<<"haha"<<std::endl;

    rocksdb::WriteBatch batch;
    batch.Put("hehe", "heha");
    std::cout<<"finish put"<<std::endl;
    db->Write(rocksdb::WriteOptions(), &batch);
    std::cout<<"finish all"<<std::endl;
}